package com.API;

public class Test10 {
    public static void main(String[] args) {
        System.out.println(id("42011715465161464X") );
        System.out.println(id("420117154651614644") );
        System.out.println(id("42011715S651614644") );
        System.out.println(id("02011715465161464X") );
        System.out.println(id("420117154651614640") );
        System.out.println(id("S2011715465161464X") );
    }

    public static boolean id(String id) {
        if (id.length() != 18) {
            return false;
        }
        if (id.charAt(0) == '0') {
            return false;
        }
        for (int i = 0; i < 17; i++) {
            if (id.charAt(i) >= '0' && id.charAt(i) <= '9') {
                continue;
            } else {
                return false;
            }
        }
        if ((id.charAt(17) <= '9' && id.charAt(17) >= '0')||id.charAt(17)=='X') {
        return true;
        }else{
            return false;
        }
    }
}
